package com.easy.service.impl;

import com.easy.zhu.LogMethod;
import com.easy.bean.AdoptBookingBean;
import com.easy.mapper.AdoptBookingDao;
import com.easy.service.AdoptBookingService;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdoptBookingServiceImpl implements AdoptBookingService {
    @Autowired
    AdoptBookingDao adoptBookingDao;
    @Override
    @LogMethod(serviceName = "用户添加信息",recordREturn = true)
    public AdoptBookingBean add(AdoptBookingBean adoptBookingBean) {
        adoptBookingDao.add(adoptBookingBean);
        AdoptBookingBean result=adoptBookingDao.one(adoptBookingBean.getId());
        return result;
    }

    @Override
    @LogMethod(serviceName = "用户删除处理")
    public int del(Integer id) {
        return adoptBookingDao.del(id);
    }

    @Override
    @LogMethod(serviceName = "用户修改处理")
    public AdoptBookingBean edit(AdoptBookingBean adoptBookingBean) {
        adoptBookingDao.edit(adoptBookingBean);
        AdoptBookingBean result=adoptBookingDao.one(adoptBookingBean.getId());
        return result;
    }

    @Override
    @LogMethod(serviceName = "用户查询单条处理")
    public AdoptBookingBean one(Integer id) {
        return adoptBookingDao.one(id);
    }

    @Override
    @LogMethod(serviceName = "用户查询所有处理")
    public List<AdoptBookingBean> all(AdoptBookingBean adoptBookingBean) {
        return adoptBookingDao.all(adoptBookingBean);
    }

    @Override
    @LogMethod(serviceName = "分页处理")
    public void page(Page page, AdoptBookingBean adoptBookingBean) {
        int count=adoptBookingDao.pageCount(adoptBookingBean);
        Object data=adoptBookingDao.page(page,adoptBookingBean);
        page.setCount(count);
        page.setData(data);

    }
}
